package fire.object;

import jgame.JGObject;
import fire.Main;
import fire.room.Map;

public class Portal extends JGObject {
	private Map map;
	private int colosionIdWith;

	public Portal(String name, double x, double y, int colosionIdWith,
			String gfxname, Map map) {
		super(name, true, x, y, 10001, gfxname);
		this.map = map;
		this.colosionIdWith = colosionIdWith;
	}

	public Portal(String name, double x, double y, int colosionIdWith,
			String gfxname, String tblFile, String oomFile, int hTiles,
			int vTiles, int playerX, int playerY) {
		super(name, true, x, y, 10001, gfxname);
		this.map = new Map(tblFile, oomFile, hTiles, vTiles, playerX, playerY);
		this.colosionIdWith = colosionIdWith;
	}

	@Override
	public void move() {
		if (checkCollision(colosionIdWith, 0, 0) == colosionIdWith) {
			changeMap();
		}
	}

	public void changeMap() {
		Main.changeMap(map);
	}
}
